import axios from 'axios'
import router from '../router'
import { showNotify } from 'vant';

const serverUrl = 'http://localhost:8080';

axios.defaults.headers['Content-Type'] = 'application/json;charset=utf-8'
const tokenName = "auth-token";

export const instance = axios.create({
    // axios中请求配置有baseURL选项，表示请求URL公共部分
    baseURL: serverUrl,//+ '/api'
    timeout: 5000,
    //允许客户端携带cookie提交给服务器。跨域请求时设置为true，保证session被提交
    withCredentials: true
});

export default instance;
export { serverUrl };